home *** CD-ROM | disk | FTP | other *** search
- (***************************************************************************)
- (** **)
- (** DDUtils By John Richardson and Dan Vanderboom **)
- (** Copyright 1990 John Richardson and Dan Vanderboom **)
- (** **)
- (** TopSoft Support Systems **)
- (** 2135 Possum Ct. **)
- (** Brookfield, Wi 53045 **)
- (** (414)796-8408 Data 12/24 **)
- (** **)
- (** **)
- (***************************************************************************)
- (** **)
- (** **)
- (** v1.00: Initial Release. **)
- (** v1.10: Added 9 more new procedures/functions. **)
- (** v1.20: Added **)
- (** **)
- (***************************************************************************)
-
- Unit DDutils;
-
- Interface
-
- Uses Dos;
-
- Function DDActive:Boolean;
- Procedure Give_Time(Amount:Integer);
- Procedure Task_Off;
- Procedure Task_On;
- Function Invisible:Boolean;
- Procedure Switch;
- Procedure Resume_Invisible;
- Procedure Kill_Other_Job;
- Procedure Suspend_Invisible;
- Procedure Clear_KeyBoard_Buffer;
- Function Send_Char(Ch:Char):Boolean;
- Function Program_Status:Integer;
- Function Task_Number:Integer;
- Function Other_Status:Integer;
- Procedure Time_Sharing(Num:Integer);
- Function Current_TimeShare:Integer;
-
- {=========================================================================}
-
- Implementation
-
- {=========================================================================}
-
- Function DDActive:Boolean;
- Var
- Regs:Registers;
- Begin
- Regs.ax := $E400;
- MsDos(Regs);
- If Regs.al <> $00 Then DDActive := True Else DDactive := False;
- End;
-
- {=========================================================================}
-
- Procedure Give_Time(Amount:Integer);
- Var
- Regs:Registers;
- Begin
- Regs.ah := $EE;
- Regs.al := Amount;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Procedure Task_Off;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $EA;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Procedure Task_On;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $EB;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Function Invisible:Boolean;
- Var
- Regs:Registers;
- Begin
- Regs.ax := $E400;
- MsDos(Regs);
- If Regs.al = $02 Then Invisible := True Else Invisible := False;
- End;
-
- {=========================================================================}
-
- Procedure Switch;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E0;
- Regs.al := 1;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Procedure Resume_Invisible;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E0;
- Regs.al := $73;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Procedure Kill_Other_Job;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E0;
- Regs.al := $74;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Procedure Suspend_Invisible;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E0;
- Regs.al := $75;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Procedure Clear_Keyboard_Buffer;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E1;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Function Send_Char(Ch:Char):Boolean;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E2;
- Regs.dl := Ord(Ch);
- MsDos(Regs);
- If Regs.al = 0 Then Send_Char := True Else Send_Char := False;
- End;
-
- {=========================================================================}
-
- Function Program_Status:Integer;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E4;
- MsDos(Regs);
- Program_Status := Regs.al;
- { al = 1 program is visible }
- { al = 1 program is invisibile }
- { al = any other value means DoubleDOS not running }
- { ah = task number (0=top, 1=bottom job) }
- End;
-
- {=========================================================================}
-
- Function Task_Number:Integer;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E4;
- MsDos(Regs);
- Task_Number := Regs.ah; { 0=top, 1=bottom }
- End;
-
- {=========================================================================}
-
- Function Other_Status:Integer;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E5;
- MsDos(Regs);
- Other_Status := Regs.al;
- { al = 0 no program running }
- { al = 1 program is running }
- { al = 2 program is suspended }
- End;
-
- {=========================================================================}
-
- Procedure Time_Sharing(Num:Integer);
- Var
- Regs:Registers;
- Begin
- { Num Variable }
- { 0 = visible program gets 70% invisible gets 30% (default) }
- { 1 = visible program gets 50% invisible gets 50% of time }
- { 2 = visible program gets 30% invisible gets 70% of time }
- { 3 = top program gets 70% bottom program gets 30% of time }
- { 4 = top program gets 30% bottom program gets 70% of time }
- { 5 = returns current priotity setting in al }
- Regs.ah := $E9;
- Regs.al := Num;
- MsDos(Regs);
- End;
-
- {=========================================================================}
-
- Function Current_TimeShare:Integer;
- Var
- Regs:Registers;
- Begin
- Regs.ah := $E9;
- Regs.al := 5;
- MsDos(Regs);
- Current_TimeShare := Regs.al;
- End;
-
- {=========================================================================}
-
- End.
-